package a.f;

import a.c.ab;
import a.c.*;
import a.c.x;
import a.d.c;
import a.d.t;
import a.d.y;

import java.util.Comparator;

public class db
  extends r
{
  private static final double g = 0.001D;
  public static final Object h = "y.layout.ParallelEdgeLayouter.SCOPE_DPKEY";
  public static final Object i = "y.layout.ParallelEdgeLayouter.MASTER_EDGE_DPKEY";
  protected ab j = new ab();
  public a.c.n k;
  protected double l = 10.0D;
  boolean m = false;
  private boolean n = false;
  private double o = 20.0D;
  private double p = 0.1D;
  private boolean q = true;
  private boolean r = true;
  public static int s;
  
  public db(rc paramrc)
  {
    this();
    a(paramrc);
  }
  
  public db() {}
  
  public boolean b()
  {
    return this.m;
  }
  
  public void a(boolean paramBoolean)
  {
    this.m = paramBoolean;
  }
  
  public boolean c()
  {
    return this.r;
  }
  
  public void b(boolean paramBoolean)
  {
    this.r = paramBoolean;
  }
  
  public void a(double paramDouble)
  {
    this.l = paramDouble;
  }
  
  public double d()
  {
    return this.l;
  }
  
  public void doLayout(o paramo)
  {
    this.k = paramo.C();
    a(paramo);
    a(paramo);
    b(paramo);
    a(paramo, this.k);
    paramo.a(this.k);
  }
  
  public boolean canLayout(o paramo)
  {
    if (!o.eg)
    {
      if (a() == null) {
        return true;
      }
      this.k = paramo.C();
      a(paramo);
    }
    boolean bool = b(paramo);
    b(paramo);
    paramo.a(this.k);
    return bool;
  }
  
  protected void a(o paramo, a.c.n paramn)
  {
    boolean bool = o.eg;
    int i2 = o.dg;
    m localm = paramo.w();
    label743:
    do
    {
      if (!localm.e()) {
        break;
      }
      d locald = localm.a();
      if (!bool)
      {
        if (paramn.get(locald) != null)
        {
          ab localab = (ab)paramn.get(locald);
          double d1 = this.l;
          if (!bool) {
            if (this.r)
            {
              if (bool) {
                break label743;
              }
              if (!this.n)
              {
                if (!bool)
                {
                  if (locald.g())
                  {
                    int i1 = localab.size() + 1;
                    localObject2 = paramo.v(locald.e());
                    double d2 = Math.min(((t)localObject2).b(), ((t)localObject2).c()) * 0.5D / (i1 + 1);
                    wc.a(paramo, locald, localab, Math.floor(Math.min(d2, this.l)), this.q, false, this.o, this.p);
                    if (bool) {
                      continue;
                    }
                    if (i2 == 0) {
                      break label816;
                    }
                  }
                  if (bool) {}
                }
                else if (paramo.m(locald).isEmpty())
                {
                  localObject1 = new a.d.z(paramo.r(locald), paramo.s(locald));
                  localObject2 = paramo.v(locald.e());
                  localObject3 = a((t)localObject2, (a.d.z)localObject1);
                  localObject4 = paramo.v(locald.f());
                  ((a.c.z)localObject3).a(a((t)localObject4, (a.d.z)localObject1));
                  ((a.c.z)localObject3).a(new c_());
                  localc1 = (c)((a.c.z)localObject3).get(1);
                  c localc2 = (c)((a.c.z)localObject3).get(2);
                  c localc3 = new c(paramo.r(locald), (a.d.z)localObject1);
                  double d4 = 2.0D * Math.min(a(localc1, localc3, (a.d.z)localObject1), a(localc2, localc3, (a.d.z)localObject1)) / (localab.size() + 2);
                  wc.a(paramo, locald, localab, Math.floor(Math.min(d4, d1)), this.q, this.n, this.o, this.p);
                  a(localab, locald.e(), paramo.r(locald), localc1, localc2, paramo);
                  a(localab, locald.f(), paramo.s(locald), localc1, localc2, paramo);
                  if (bool) {
                    continue;
                  }
                  if (i2 == 0) {
                    break label816;
                  }
                }
                Object localObject1 = paramo.n(locald);
                Object localObject2 = ((y)localObject1).a(0).i();
                Object localObject3 = paramo.v(locald.e());
                Object localObject4 = a((t)localObject3, (a.d.z)localObject2);
                c localc1 = new c(paramo.r(locald), (a.d.z)localObject2);
                double d3 = 2.0D * Math.min(a((c)((a.c.z)localObject4).a(), localc1, (a.d.z)localObject2), a((c)((a.c.z)localObject4).d(), localc1, (a.d.z)localObject2)) / (localab.size() + 2);
                localObject2 = ((y)localObject1).a(((y)localObject1).j() - 2).i();
                t localt = paramo.v(locald.f());
                a.c.z localz = a(localt, (a.d.z)localObject2);
                d3 = Math.min(d3, a((c)localz.a(), (c)localz.d(), (a.d.z)localObject2) / (localab.size() + 2));
                wc.a(paramo, locald, localab, Math.floor(Math.min(d3, d1)), this.q, this.n, this.o, this.p);
                a(localab, locald.e(), paramo.r(locald), (c)((a.c.z)localObject4).a(), (c)((a.c.z)localObject4).d(), paramo);
                a(localab, locald.f(), paramo.s(locald), (c)localz.a(), (c)localz.d(), paramo);
                if (bool) {
                  continue;
                }
                if (i2 == 0) {
                  break label816;
                }
              }
            }
          }
          if (!bool)
          {
            if (locald.g()) {
              wc.a(paramo, locald, localab, Math.floor(d1), this.q, false, this.o, this.p);
            }
          }
          else
          {
            if (bool) {
              continue;
            }
            if (i2 == 0) {
              break label816;
            }
          }
          wc.a(paramo, locald, localab, Math.floor(d1), this.q, this.n, this.o, this.p);
        }
        localm.f();
      }
    } while (i2 == 0);
    label816:
  }
  
  private void a(ab paramab, e parame, a.d.w paramw, c paramc1, c paramc2, o paramo)
  {
    boolean bool2 = o.eg;
    int i3 = o.dg;
    t localt = paramo.v(parame);
    if (!bool2) {}
    int i1 = !localt.a(paramw) ? 1 : 0;
    a.d.w localw1 = i1 != 0 ? paramw : paramo.o(parame);
    c localc1 = new c(localw1, new a.d.z(1.0D, 0.0D));
    c localc2 = new c(localw1, new a.d.z(0.0D, 1.0D));
    boolean bool1 = a(localt, localc2, localc1, paramc1, paramc2);
    m localm = paramab.l();
    label259:
    do
    {
      if (!localm.e()) {
        break;
      }
      d locald = localm.a();
      int i2 = locald.e() == parame ? 1 : 0;
      y localy = paramo.n(locald);
      a.d.n localn = i2 != 0 ? localy.a(0) : localy.a(localy.j() - 2);
      c localc3 = localn.j();
      a.d.w localw2 = bool1 ? c.a(localc1, localc3) : c.a(localc2, localc3);
      if (!bool2)
      {
        if (i2 != 0) {
          paramo.c(locald, localw2);
        }
      }
      else
      {
        if (bool2) {
          continue;
        }
        if (i3 == 0) {
          break label259;
        }
      }
      paramo.d(locald, localw2);
      localm.f();
    } while (i3 == 0);
  }
  
  private boolean a(t paramt, c paramc1, c paramc2, c paramc3, c paramc4)
  {
    boolean bool = o.eg;
    a.d.w localw1 = c.a(paramc1, paramc3);
    if (!bool) {
      if (localw1 == null) {
        return true;
      }
    }
    a.d.w localw2 = c.a(paramc1, paramc4);
    if (((bool) || (a(paramt, localw1))) && ((bool) || (a(paramt, localw2)))) {
      return false;
    }
    a.d.w localw3 = c.a(paramc2, paramc3);
    if (!bool) {
      if (localw3 == null) {
        return false;
      }
    }
    a.d.w localw4 = c.a(paramc2, paramc4);
    if (((bool) || (a(paramt, localw3))) && ((bool) || (a(paramt, localw4)))) {
      return true;
    }
    double d1 = Math.abs(localw3.a - localw4.a);
    double d2 = Math.abs(localw1.b - localw2.b);
    if (!bool) {}
    return d1 < d2;
  }
  
  private static boolean a(t paramt, a.d.w paramw)
  {
    boolean bool = o.eg;
    if (((bool) || (paramw.a() + 0.001D >= paramt.d())) && ((bool) || (paramw.a() - paramt.d() <= paramt.b() + 0.001D)) && ((bool) || (paramw.b() + 0.001D >= paramt.e()))) {
      if (bool) {}
    }
    return paramw.b() - paramt.e() <= paramt.c() + 0.001D;
  }
  
  private static double a(c paramc1, c paramc2, a.d.z paramz)
  {
    boolean bool = o.eg;
    c localc = new c(new a.d.w(0.0D, 0.0D), a.d.z.c(paramz));
    a.d.w localw1 = c.a(paramc1, localc);
    a.d.w localw2 = c.a(paramc2, localc);
    if ((bool) || (localw1 != null))
    {
      if (bool) {
        break label64;
      }
      if (localw2 != null) {}
    }
    else
    {
      return 0.0D;
    }
    label64:
    return a.d.w.a(localw1, localw2);
  }
  
  private static a.c.z a(t paramt, a.d.z paramz)
  {
    a.d.w localw1 = new a.d.w(paramt.d() + 0.5D * paramt.b(), paramt.e());
    a.d.w localw2 = new a.d.w(paramt.d(), paramt.e() + 0.5D * paramt.c());
    a.d.w localw3 = new a.d.w(paramt.d() + 0.5D * paramt.b(), paramt.e() + paramt.c());
    a.d.w localw4 = new a.d.w(paramt.d() + paramt.b(), paramt.e() + 0.5D * paramt.c());
    a.c.z localz1 = new a.c.z();
    localz1.add(new c(localw1, paramz));
    localz1.add(new c(localw2, paramz));
    localz1.add(new c(localw4, paramz));
    localz1.add(new c(localw3, paramz));
    localz1.a(new c_());
    a.c.z localz2 = new a.c.z();
    localz2.add(localz1.a());
    localz2.add(localz1.d());
    return localz2;
  }
  
  private ab a(e parame)
  {
    boolean bool = o.eg;
    int i1 = o.dg;
    ab localab = new ab(parame.n());
    m localm = parame.m();
    do
    {
      if (!localm.e()) {
        break;
      }
      d locald = localm.a();
      if (!bool)
      {
        if (!locald.g()) {
          localab.add(locald);
        }
        localm.f();
      }
    } while (i1 == 0);
    return localab;
  }
  
  protected void a(q paramq)
  {
    boolean bool = o.eg;
    int i1 = o.dg;
    x localx = paramq.B();
    k localk1 = paramq.c(h);
    k localk2 = paramq.c(i);
    a.c.w localw = paramq.v();
    label95:
    do
    {
      do
      {
        if (!localw.e()) {
          break label415;
        }
        e locale1 = localw.d();
        if (!bool)
        {
          if (i1 != 0) {
            return;
          }
          if (bool) {
            break label95;
          }
        }
        ab localab1 = this.m ? new ab(locale1.n()) : a(locale1);
        if (localk2 != null) {
          localab1.a(new b_(localk2, null));
        }
        m localm = localab1.l();
        d locald1;
        e locale2;
        do
        {
          do
          {
            if (!localm.e()) {
              break label327;
            }
            locald1 = localm.a();
            if (i1 != 0) {
              break;
            }
            if ((localk1 == null) || (localk1.getBool(locald1)))
            {
              locale2 = locald1.a(locale1);
              d locald2 = (d)localx.get(locale2);
              if ((bool) || (locald2 != locald1))
              {
                if (!bool) {
                  if (locald2 == null)
                  {
                    localx.a(locale2, locald1);
                    if (bool) {
                      continue;
                    }
                    if (i1 == 0) {
                      break label315;
                    }
                  }
                }
                if (!bool) {
                  if (this.k.get(locald2) == null) {
                    this.k.a(locald2, new ab());
                  }
                }
                ab localab2 = (ab)this.k.get(locald2);
                localab2.add(locald1);
                this.j.c(locald1);
                paramq.f(locald1);
              }
            }
            localm.f();
          } while (i1 == 0);
        } while (bool);
        localm = locale1.l();
        do
        {
          if (!localm.e()) {
            break;
          }
          locald1 = localm.a();
          locale2 = locald1.a(locale1);
          localx.a(locale2, null);
          localm.f();
          if (bool) {
            break label412;
          }
          if (i1 != 0) {
            break label410;
          }
        } while (i1 == 0);
      } while (bool);
      localw.f();
    } while (i1 == 0);
    label315:
    label327:
    if (!bool) {
      paramq.a(localx);
    }
    label410:
    label412:
    label415:
    return;
  }
  
  private void b(q paramq)
  {
    boolean bool = o.eg;
    do
    {
      int i1 = o.dg;
      while (i1 == 0)
      {
        if (this.j.isEmpty()) {
          break;
        }
        paramq.g(this.j.o());
      }
    } while (bool);
  }
  
  public boolean e()
  {
    return this.n;
  }
  
  public void c(boolean paramBoolean)
  {
    this.n = paramBoolean;
  }
  
  public double f()
  {
    return this.o;
  }
  
  public void b(double paramDouble)
  {
    this.o = paramDouble;
  }
  
  public double g()
  {
    return this.p;
  }
  
  public void c(double paramDouble)
  {
    this.p = paramDouble;
  }
  
  public boolean h()
  {
    return this.q;
  }
  
  public void d(boolean paramBoolean)
  {
    this.q = paramBoolean;
  }
  
  private static class b_
    implements Comparator
  {
    final k a;
    
    private b_(k paramk)
    {
      this.a = paramk;
    }
    
    public int compare(Object paramObject1, Object paramObject2)
    {
      boolean bool = o.eg;
      if (!bool) {
        if (this.a.getBool(paramObject1))
        {
          if (bool) {
            break label50;
          }
          if (!this.a.getBool(paramObject2)) {
            return -1;
          }
        }
      }
      label50:
      if (!bool) {
        if (!this.a.getBool(paramObject1))
        {
          if (bool) {
            break label77;
          }
          if (this.a.getBool(paramObject2)) {
            return 1;
          }
        }
      }
      label77:
      return 0;
    }
    
    b_(k paramk, db.0 param0)
    {
      this(paramk);
    }
  }
  
  static class c_
    implements Comparator
  {
    public int compare(Object paramObject1, Object paramObject2)
    {
      boolean bool = o.eg;
      c localc1 = (c)paramObject1;
      c localc2 = (c)paramObject2;
      if (!bool) {
        if (localc1.c() < localc2.c()) {
          return -1;
        }
      }
      if (!bool) {
        if (localc1.c() > localc2.c()) {
          return 1;
        }
      }
      return 0;
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.db

 * JD-Core Version:    0.7.0.1

 */